﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace GTAHookAdv
{
    /// <summary>
    /// This class extends GTA.Game class. with some nice functionalities
    /// </summary>
    public class g_Game
    {


        /// <summary>
        /// Display text à the bottom middle of the screen like when peds are chatting.
        /// </summary>
        /// <param name="text">text do display</param>
        /// <param name="howlong">how long to display in milliseconds</param>
        public static void DisplaySubTitle(String text, int howlong)
        {
            text = text.Replace("\r\n", "~n~");
            GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", text, howlong, 1);
        }

        /// <summary>
        /// Display text à the bottom middle of the screen like when peds are chatting.
        /// </summary>
        /// <param name="text">text do display</param>
        /// <param name="howlong">how long to display in milliseconds</param>
        /// <param name="color"> supported colors : red, blue, green, orange, purple, black , gray </param>
        public static void DisplaySubTitle(String text, int howlong, Color color)
        {
            text = text.Replace("\r\n", "~n~");
            switch (color.Name)
            {
                case "Red":
                    text = "~r~ " + text;
                    break;
                case "Green":
                    text = "~COL_NET_3~ " + text;
                    break;
                case "Orange":
                    text = "~COL_NET_1~ " + text;
                    break;
                case "Purple":
                    text = "~COL_NET_16~ " + text;
                    break;
                case "Black":
                    text = "~l~ " + text;
                    break;
                case "Gray":
                    text = "~c~ " + text;
                    break;
                default:
                    break;
            }
            GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", text, howlong, 1);
        }
       
        /// <summary>
        /// Say if a real game mission is running, not if a GTAHookAdv.Missions.Mission is running
        /// <seealso cref="GTAHookAdv.Missions"/>
        /// </summary>
        public static bool IsMissionRunning
        {
            get { return GTA.Native.Function.Call<int>("GET_MISSION_FLAG") != 0; }
        }

       
    }
}
